package com.tfswue.dyq.controller;

import com.tfswue.dyq.service.EventPublisherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class RegestController {
    @Autowired
    private EventPublisherService eventPublisher;

    @PostMapping("/register")
    public ResponseEntity<String> registerUser(
            @RequestParam String username,
            @RequestParam String email) {
        // 发布用户注册事件
        eventPublisher.publishUserRegisteredEvent(username, email);
        return ResponseEntity.ok("注册成功 ");

    }
}
